<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:concept="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-02-19T00:00:00" />
    </reg:owner>
  </owners>

  <number>80205</number>

  <name>Function test xfi:identical-node-set</name>

  <documentation>
    <xhtml:p>
      Tests of xfi:identical-node-set($left as node()*, $right as node()*) as xs:boolean
    </xhtml:p>
  </documentation>

  <variation id="V-01">
    <name>Works for set of three in order.</name>
    <documentation>
      <xhtml:p>
        Tests that the function returns true for identical sets in order
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="facts-in-instance.xsd"/>
      <instance readMeFirst="true" id="V01" xlink:type="simple" xlink:href="tuple-instance.xml"/>
      <cfcn:call file="V01">
        xfi:identical-node-set(
            (/xbrli:xbrl, 
             //xbrli:context[@id eq 'context-vulcan'], 
             //concept:t1[@id eq 'i2']),
            (/xbrli:xbrl, 
             //xbrli:context[@id eq 'context-vulcan'], 
             //concept:t1[@id eq 'i2'])
             )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count( $result ) eq 1 and $result eq true()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Works for set of three, second different order.</name>
    <documentation>
      <xhtml:p>
        Tests that the function returns true for identical sets not in order
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="facts-in-instance.xsd"/>
      <instance readMeFirst="true" id="V02" xlink:type="simple" xlink:href="tuple-instance.xml"/>
      <cfcn:call file="V02">
        xfi:identical-node-set(
            (/xbrli:xbrl, 
             //xbrli:context[@id eq 'context-vulcan'], 
             //concept:t1[@id eq 'i2']),
            (/xbrli:xbrl, 
             //concept:t1[@id eq 'i2'],
             //xbrli:context[@id eq 'context-vulcan'])
             )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq true()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Works for set of three, second different order.</name>
    <documentation>
      <xhtml:p>
        Tests that the function returns true for extra entry in second set
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="facts-in-instance.xsd"/>
      <instance readMeFirst="true" id="V03" xlink:type="simple" xlink:href="tuple-instance.xml"/>
      <cfcn:call file="V03">
        xfi:identical-node-set(
            (/xbrli:xbrl, 
             //xbrli:context[@id eq 'context-vulcan'], 
             //concept:t1[@id eq 'i2']),
            (/xbrli:xbrl, 
             //concept:t1[@id eq 'i2'],
             //xbrli:context[@id eq 'context-vulcan'],
             (: this is superfluous, but allowed by definition
                though possibly disallowed if strict set membership enforced :)
             /xbrli:xbrl)
             )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq true()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Works for set of three, second different order.</name>
    <documentation>
      <xhtml:p>
        Tests that the function returns false if missing entry
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="facts-in-instance.xsd"/>
      <instance readMeFirst="true" id="V04" xlink:type="simple" xlink:href="tuple-instance.xml"/>
      <cfcn:call file="V04">
        xfi:identical-node-set(
            (/xbrli:xbrl, 
             //xbrli:context[@id eq 'context-vulcan'], 
             //concept:t1[@id eq 'i2']),
            (/xbrli:xbrl, 
             //concept:t1[@id eq 'i2'],
             //xbrli:context[@id eq 'context-earth'])
             )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq false()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Works for an empty set.</name>
    <documentation>
      <xhtml:p>
        Tests that the function returns true for empty set
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="facts-in-instance.xsd"/>
      <instance readMeFirst="true" id="V05" xlink:type="simple" xlink:href="empty-instance.xml"/>
      <cfcn:call file="V05">
        xfi:identical-node-set( (), ())
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count( $result ) eq 1 and $result eq true()
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Wrong node to function</name>
    <documentation>
      <xhtml:p>
        XBRL-defined error for node type incorrect.
      </xhtml:p>
    </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="facts-in-instance.xsd"/>
      <instance readMeFirst="true" id="V06" xlink:type="simple" xlink:href="tuple-instance.xml"/>
      <cfcn:call file="V06">
        xfi:identical-node-set((//xbrli:context[1]), ("hello world"))
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xqt-err:XPTY0004</error>
    </outputs>
  </variation>  


  <revisions>
    <reg:revision on="2008-04-01T00:00:00" by="herm">
      <xhtml:p>
        Fixed instance name and contents.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2008-01-30T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>
  </revisions>
  
</testcase>
